package edu.isquen.core.role.action;

import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

import edu.isquen.core.base.model.ValueObject;
import edu.isquen.core.role.model.Role;
import edu.isquen.core.role.service.RoleService;
import edu.isquen.util.factory.ServiceFactory;


public class RoleHelper {

	public Map<String, String> getRoleList(){
		Map<String, String> map=new HashMap<String, String>();
		map.put("", "——选择角色——");
		try {
			RoleService roleprocess = (RoleService) ServiceFactory.createProcess(RoleService.class);
			Collection<ValueObject> rolelist=roleprocess.doQuery().datas;
			for(Iterator<ValueObject> iter=rolelist.iterator();iter.hasNext();){
				Role role=(Role) iter.next();
				if(role!=null){
					map.put(role.getId(), role.getName());
				}
			}
		} catch (Exception e) {
			return map;
		}
		return map;
	}
}
